package com.audi.box.service;

import java.util.ArrayList;

import com.audi.box.adapter.SQLiteAsusHelperPlace;
import com.audi.dto.PlaceItem;

public class PlaceServiceImp implements PlaceService {
    
    private SQLiteAsusHelperPlace mSQLHelper;
    
    public PlaceServiceImp(SQLiteAsusHelperPlace mSQLHelper) throws Exception {
        this.mSQLHelper = mSQLHelper;
    }
    
    public void setSQLiteHelper(SQLiteAsusHelperPlace mSQLHelper) {
        this.mSQLHelper = mSQLHelper;
    }
    
    @Override
    public int addPlace(PlaceItem place) {
        return mSQLHelper.addPlace(place);
    }
    
    @Override
    public int updatePlace(PlaceItem place) {
        return mSQLHelper.updatePlace(place);
    }
    
    @Override
    public int renamePlace(PlaceItem place) {
        // return mSQLHelper.renamePlace(place);
        return mSQLHelper.updatePlace(place);
    }
    
    @Override
    public int changeCapabilityPlace(PlaceItem place) {
        return mSQLHelper.updatePlace(place);
        // return mSQLHelper.changeCapabilityPlace(place);
    }
    
    @Override
    public int deletePlace(PlaceItem place) {
        return mSQLHelper.deletePlace(place);
    }
    
    @Override
    public boolean isExist(PlaceItem place) {
        return mSQLHelper.checkExistPlace(place);
    }
    
    @Override
    public boolean isExistByName(PlaceItem place) {
        return mSQLHelper.checkExistPlaceByName(place);
    }
    
    @Override
    public ArrayList<PlaceItem> getListPlace() {
        return mSQLHelper.getListPlace();
    }
    
    @Override
    public ArrayList<PlaceItem> getListPlaceByUserId(int userId) {
        // TODO Auto-generated method stub
        // no parameter userid ???
        return null;
    }
    
    @Override
    public PlaceItem getPlaceByDeviceId(int deviceId) {
        return mSQLHelper.getPlaceItemByDevice(deviceId);
    }
    
    @Override
    public PlaceItem getPlace(int placeId) {
        return mSQLHelper.getPlacebyId(placeId);
    }
}
